package com.dukun.mybatis.convert;

import com.dukun.mybatis.entity.Student;
import org.mapstruct.MapMapping;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 集合转换器
 *
 * @author dukun
 * date：2021/11/30
 */
@Mapper
public interface CollectionsConvert {

    CollectionsConvert INSTANCE = Mappers.getMapper(CollectionsConvert.class);

    /**
     * Students ---> StudentDtos
     *
     * @param students Students
     * @return StudentDtos
     */
    List<Student> studentsToStudentDtos(List<Student> students);

    /**
     * Map之间的映射
     *
     * @param source Map
     * @return Map
     */
    @MapMapping(valueDateFormat = "yy-MM-dd hh:mm:ss")
    Map<String, String> dateValueMapToStringValueMap(Map<String, Date> source);
}
